<template>
    <div class="book-page-section">
        <!-- 竖着的书本排列 -->
        <div 
            class="book-col"
            v-if="detail.module == 36 ">
            <div class="title">{{detail.name}}</div>
            <ul>
                <li 
                    v-for="item,index in detail.list"
                    :key="index"
                    @click="gotoChater(item.id)">
                    <div class="photo">
                        <img :src="item.cover" alt="">
                    </div>
                    <div class="text">
                        <div class="book-name shortTxt">{{item.title}}</div>
                        <div class="author shortTxt">{{item.author}} / {{item.category}}</div>
                        <div class="discription">
                            {{item.content}}
                        </div>
                    </div>
                </li>
            </ul>
        </div>
        <!-- 横着的书本排列 -->
        <div 
            class="book-row"
            v-if="detail.module == 34 || detail.module == 45">
            <div class="title">{{detail.name}}</div>
            <ul>
                <li 
                    v-for="item,index in detail.list"
                    :key="index"
                    @click="gotoChater(item.id)">
                    <img :src="item.cover" alt="">
                    <div class="text">{{item.title}}</div>
                </li>
            </ul>
        </div>
    </div>
</template>

<script>
export default {
    name: 'bookPageSection',
    props: {
        detail: Object,
    },
    methods: {
        gotoChater(id) {
            this.$router.push('/book-chater/'+id+'/m');
        }
    }
}
</script>

<style lang="scss" scoped>
@import '@/assets/common/variable.scss';
.title {
    font-size: 20px;
    font-weight: bold;
}
.book-col {
    font-size: 16px;
    padding: 15px;
    border-bottom: 1px solid #ccc;
    margin-bottom: -1px;
    .photo {
        margin-right: 8px;
    }
    img {
        width: 74px;
        height: 100px;
    }
    li {
        margin-top: 16px;
        display: flex;
    }
    .text {
        width: 263px;
        .book-name {
            font-family: oppo-l;
            font-size: 18px;
            font-weight: bold;
            height: 24px;
        }
        .author {
            margin-top: 9px;
            font-size: 12px;
            height: 20px;
        }
        .discription {
            margin-top: 14px;
            height: 38px;
            font-size: 14px;
            display:-webkit-box;/*对象作为伸缩盒子模型展示*/
            -webkit-box-orient:vertical;/*设置或检索伸缩盒子对象的子元素的排列方式*/
            -webkit-line-clamp:2;/*显示的行数*/
            overflow:hidden;/*隐藏超出的*/
        }
    }
}
.book-row {
    padding: 15px;
    border-bottom: 1px solid #ccc;
    margin-bottom: -1px;
    ul {
        display: flex;
        margin-top: 10px;
        justify-content: space-between;
        width: 100%;
        overflow: hidden;
    }
    img {
        width: 104px;
        height: 140px;
    }
    .text {
        width: 104px;
        font-size: 14px;
    }
}
</style>